Skip to content

Conversation

@Chase-Grajeda
Copy link
Contributor

Implements a wrapper to run a Mamba SummaryNetwork with BayesFlow

  • Current implementation is locked to Torch backends only given fundamental constraints.
  • Nvidia GPUs are highly recommended; AMD cards have extra setup required for compatibility.
  • CPU is not supported.

https://github.com/state-spaces/mamba

Chase-Grajeda and others added 18 commits February 4, 2025 10:12
Added wrappers folder.
Added Mamba SummaryNetwork wrapper.
Added necessary __init__ files.
Added MambaSSM docstring.
Added try-catch for Mamba import to remove hard dependence.
Added docstring for MambaSSM.
Added custom parameters for MambaSSM.
Removed (temp) serializable decorator and import from MambaSSM.
Added mamba_version arg to MambaSSM constructor.
Added mamba_blocks arg to MambaSSM constructor.
Reordered args in MambaSSM constructor.
Updated docstring for MambaSSM.
Added block generation and version handling to MambaSSM wrapper.
Updated LV benchmark docstring.
Added necessary device spec to Mamba generator.
Added activation between Mamba blocks.
Switched ReLU to Sigmoid activation. ReLU caused exploding gradients
Switched activation to softplus
Switched activation to log1exp
Removed activations.
Added dt_min, dt_max args
Fixed py syntax error
Added LayerNorm to Mamba blocks
Reorder layerNorm and SSM operation
Added soft scaling after mamba pass
Replaced generator with specific mamba constructors due to new input args.
Added new hidden ssm dim arg.
Removed mamba2 support due to instability
Removed file that will be later renamed on dev
@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2025

Codecov Report

Attention: Patch coverage is 35.48387% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
bayesflow/wrappers/mamba/mamba.py 31.03% 20 Missing ⚠️
Files with missing lines Coverage Δ
bayesflow/__init__.py 100.00% <ø> (ø)
.../simulators/benchmark_simulators/lotka_volterra.py 21.62% <ø> (ø)
bayesflow/wrappers/__init__.py 100.00% <100.00%> (ø)
bayesflow/wrappers/mamba/__init__.py 100.00% <100.00%> (ø)
bayesflow/wrappers/mamba/mamba.py 31.03% <31.03%> (ø)

Updated mamba block init for linting rules
Additional updates from ruff
@stefanradev93
Copy link
Contributor

Great, Chase! Can you merge dev into your branch and make sure the tests are running. Also, no need to change the SIR notebook (revert to default), since we will take one of your upcoming notebooks as an example.

@LarsKue LarsKue marked this pull request as draft April 7, 2025 22:56
@stefanradev93
Copy link
Contributor

Implemented as we did in the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants